import React, { PureComponent } from 'react';
import { Icon } from 'antd';
import { download } from '@/utils/sysFun';

export default class FileList extends PureComponent {
  render() {
    const { style, list, downloadUrl } = this.props;
    return (
      <div style={style}>
        {list && list.length > 0
          ? list.map(item => (
              <div key={item.fileId} className="fileList">
                <Icon type="paper-clip" />
                <a onClick={() => download(downloadUrl, { fileId: item.fileId })}>
                  {item.fileName}
                </a>
              </div>
            ))
          : '无附件'}
      </div>
    );
  }
}
